package com.daocao.jy.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.Spanned;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.daocao.jy.R;
import com.daocao.jy.util.Spans;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * Created by xsooy-pc on 2017/10/23.
 */

public class RechargeRecordAdapter extends ItemAdapter<String, RechargeRecordAdapter.DefaultHolder> {

    private final int textSize26;


    private Context context;

    public RechargeRecordAdapter(Context context) {
        super(context);
        textSize26 = context.getResources().getDimensionPixelSize(R.dimen.x26);
        this.context = context;
    }

    @Override
    public DefaultHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new DefaultHolder(inflate(R.layout.item_recharge_record, parent));
    }

    @Override
    public void onBindViewHolder(DefaultHolder holder, int position) {
        Spanned textTwo = Spans.with(context).font("所选加油套餐：15个月\n", textSize26, 0xff333333).
                font("每月到账金额：", textSize26, 0xff333333).font("1000.00元\n", textSize26, 0xffFB5E01).
                font("累计到账总额：15000.00元\n", textSize26, 0xff333333).
                font("应付金额：15000.00元\n", textSize26, 0xff333333).
                font("实际付款金额：", textSize26, 0xff333333).font("9000.00元\n", textSize26, 0xffFB5E01).
                font("付款时间：2018-04-04", textSize26, 0xff333333).
                build();
        holder.txtInfo.setText(textTwo);
    }

    class DefaultHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.txt_name)
        TextView txtName;
        @BindView(R.id.txt_card)
        TextView txtCard;
        @BindView(R.id.txt_info)
        TextView txtInfo;

        public DefaultHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
